//
//(C) Copyright 2011 HongKong Airline.,Ltd. 
//
/**
 * packageinfoAction
 * 项目名称:代购系统
 * @author Mengxiangliang
 * 功能描述:
 * 历史版本:2013-01-04 v1.0.0 Mengxiangliang  创建:
 * @version [V1] 
 */
package com.gamutsoft.amb.packageinfo.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.gamutsoft.amb.base.action.BaseAction;
import com.gamutsoft.amb.common.bean.QueryExample;
import com.gamutsoft.amb.common.exception.BusinessException;
import com.gamutsoft.amb.packageinfo.model.Packageinfo;
import com.gamutsoft.amb.packageinfo.service.IPackageinfoService;


@SuppressWarnings({"serial","rawtypes"})
public class PackageinfoAction extends BaseAction {
	
	private Packageinfo packageinfo;
	
	private List<Map> packageinfoList;
	
	private IPackageinfoService packageinfoService;
	
	private Map<String,Object> staticMap;

	/**
	 * 初始化查询Packageinfo信息
	 * @author Mengxiangliang
	 * @return
	 */
	public String initSearchPackageinfo()throws BusinessException, Exception {
		try {
		  //获取统计信息
			if(packageinfo==null){
				packageinfo=new Packageinfo();
				packageinfo.setUserId(super.getSystemUser().getId());
			}
			List<Map>list=packageinfoService.staticPackageinfo(new QueryExample(), packageinfo);
			staticMap=new HashMap();
			if(list!=null && list.size()!=0){
				for(Map map:list){
					staticMap.put(map.get("status").toString(), map.get(" num"));
				}
			}
			packageinfoList=packageinfoService.searchPackageinfoListByWhere(new QueryExample(), packageinfo);
		}catch(Exception e){
			log.error(e);
		}
		return "search_packageinfo_success";
	}
	
	/**
	 * @return the packageinfo
	 */
	public Packageinfo getPackageinfo() {
		return packageinfo;
	}

	/**
	 * @param packageinfo the packageinfo to set
	 */
	public void setPackageinfo(Packageinfo packageinfo) {
		this.packageinfo = packageinfo;
	}

	/**
	 * @return the packageinfoList
	 */
	public List<Map> getPackageinfoList() {
		return packageinfoList;
	}

	/**
	 * @param packageinfoList the packageinfoList to set
	 */
	public void setPackageinfoList(List<Map> packageinfoList) {
		this.packageinfoList = packageinfoList;
	}

	/**
	 * @param packageinfoService the packageinfoService to set
	 */
	public void setPackageinfoService(IPackageinfoService packageinfoService) {
		this.packageinfoService = packageinfoService;
	}

	public Map<String, Object> getStaticMap() {
		return staticMap;
	}

	public void setStaticMap(Map<String, Object> staticMap) {
		this.staticMap = staticMap;
	}
	
}
